<?php namespace Home\Controller; 

use Hdphp\Controller\Controller;

//测试控制器
class IndexController extends Controller{

	//构造函数
	public function __init()
	{
	}
	
    //动作
    public function index(){
       	$goodsModel=new \Common\Model\Goods;
	   	$danpinData=$goodsModel->orderBy('gid','ASC')->limit(8)->get();
	   	View::with('danpinData',$danpinData);		
		$xinpinData=$goodsModel->orderBy('gid','DESC')->limit(6)->get();
	   	View::with('xinpinData',$xinpinData);
		
		$allData=$goodsModel->orderBy('gid','DESC')->limit(20)->get();
	   	View::with('allData',$allData);
		
		$brandModel=new \Common\Model\Brand;
		$brandData=$brandModel->orderBy('bid','ASC')->limit(12)->get();   
		View::with('brandData',$brandData);
		
		$cateModel=new \Common\Model\Cate;
		
//		上装-----------------
		$szCateData=$cateModel->where('pid',26)->limit(12)->get();
	   	View::with('szCateData',$szCateData);
		
		$szGoodsData=Db::table('goods')
		->join('category','category_cid','=','cid')
		->where('pid',26)
		->limit(6)
		->orderBy('gid','ASC')
		->get();				
//		var_dump($szGoodsData);die;
		View::with('szGoodsData',$szGoodsData);
		
//		下装-----------------
		$xzCateData=$cateModel->where('pid',27)->limit(12)->get();
	   	View::with('xzCateData',$xzCateData);
		
		$xzGoodsData=Db::table('goods')
		->join('category','category_cid','=','cid')
		->where('pid',27)
		->limit(6)
		->orderBy('gid','ASC')
		->get();				
		View::with('xzGoodsData',$xzGoodsData);	
		
//		鞋履---------------------
		$shoeCateData=$cateModel->where('pid in (28,29)')->limit(12)->get();
	   	View::with('shoeCateData',$shoeCateData);
		
		$shoeGoodsData=Db::table('goods')
		->join('category','category_cid','=','cid')
		->where('pid in (28,29)')
		->limit(6)
		->orderBy('gid','DESC')
		->get();				
		View::with('shoeGoodsData',$shoeGoodsData);		
		
//		配饰----------------
		$accCateData=$cateModel->where('pid in (32,33,34)')->limit(12)->get();
	   	View::with('accCateData',$accCateData);
		
	   View::make();
    }
}
